import Utils from "../Utils";

export default class UserData{
    public id:number=0;
    public gold:number=0;
    public currGate:number=0;
    public growNum:number=2;
    constructor(){

    }

    public addGlod(value:number){
        this.gold += value;
        if(this.gold<0)this.gold=0;
    }

    public addGrowNum(value:number){
        this.growNum += value;
        if(this.growNum<0)this.growNum=0;
    }

    public addItemByStr(str:string){

    }

    public parseFromLocal(data){
        Utils.copyObjAtt(this,data);
    }

    public parseFromServer(data){

    }

    public getSaveData(){
        let tdata = {};
        Utils.copyObjAtt2(tdata,this);
        return tdata;
    }
}